package com.emperor.controller.taskservice;

import com.emperor.result.Result;
import com.emperor.service.TaskService;
import com.emperor.vo.TaskReportInfoVO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.format.annotation.DateTimeFormat;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Date;

@RestController
@Api(tags = "工单统计")
@RequestMapping("/task-service/task")
public class TaskController {

    @Autowired
    private TaskService taskService;

    @ApiOperation("工单统计")
    @GetMapping("/taskReportInfo/{start}/{end}")
    public Result<TaskReportInfoVO> taskReportInfo(@PathVariable @DateTimeFormat(fallbackPatterns = "yyyy-MM-dd HH:mm:ss") Date start,
                                 @PathVariable @DateTimeFormat(fallbackPatterns = "yyyy-MM-dd HH:mm:ss") Date end) {

        TaskReportInfoVO vo= taskService.taskReportInfo(start, end);
        return Result.success(vo);
    }
}
